package com.cskaoyan.service;

import com.cskaoyan.bean.MallAdmin;
import com.cskaoyan.bean.MallAdminExample;
import com.cskaoyan.bean.param.BaseParam;
import com.cskaoyan.mapper.MallAdminMapper;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author stone
 * @date 2022/04/07 09:33
 */
@Service
public class AdminServiceImpl implements AdminService{

    @Autowired
    MallAdminMapper adminMapper;

    @Override
    public List<MallAdmin> query(BaseParam param) {
        PageHelper.startPage(param.getPage(), param.getLimit());
        MallAdminExample example = new MallAdminExample();
        example.setOrderByClause(param.getSort() + " " + param.getOrder());

        List<MallAdmin> mallAdmins = adminMapper.selectByExample(example);

        return mallAdmins;
    }
}
